﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows.Media.Imaging;
using System.Windows.Controls;

namespace WTwitter.ViewModel.Utility {
	/// <summary>
	/// 押すことができる画像（=画像付きボタン）
	/// </summary>
	public class ImageButton : ViewModelBase {
		private readonly string _description;
		private readonly ICommand _command;
		private readonly BitmapImage _image;

		private static Dictionary<string, BitmapImage> _imageCache = new Dictionary<string, BitmapImage>();

		public ImageButton(string description, ICommand command, BitmapImage image) 
			: base(description) {
			System.Diagnostics.Debug.Assert(image.GetType() == typeof(BitmapImage));
			_description = description;
			_command = command;
			_image = image;
		}

		#region Property
		/// <summary>
		/// ボタンの機能の説明
		/// </summary>
		public string Description {
			get { return _description; }
		}

		/// <summary>
		/// 押されたときのコマンド
		/// </summary>
		public ICommand Command {
			get { return _command; }
		}

		/// <summary>
		/// ボタンに表示するイメージ
		/// </summary>
		public BitmapImage Image {
			get { return _image; }
		}

		#endregion
	}
}
